# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sleuthkit-java
_pkgname=sleuthkit
pkgver=4.14.0
pkgrel=1
pkgdesc='Java dependencies for The Sleuth Kit.'
arch=('x86_64')
url='https://github.com/sleuthkit/sleuthkit/releases/'
license=('CPL, custom:"IBM Public Licence", GPL2')
depends=('java-runtime' 'sleuthkit')
makedepends=('ant' 'java-environment')
source=("https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-$pkgver/sleuthkit-$pkgver.tar.gz")
sha512sums=('cc486ced49595f830e473bf3831b0b02525305c29795e3e17f0292231a0c25c619463b02584c3266b61c33a77912b73eefc257ff9aa3c9af68102b49e3e99105')

build() {
  cd "$_pkgname-$pkgver"

  ./configure
  make

  (cd bindings/java;
  ant
  )

  (cd case-uco/java;
  ant
  )
}

package() {
  cd "$_pkgname-$pkgver"

  install -d "$pkgdir/usr/share/java"
  install -Dm 644 "bindings/java/dist/$_pkgname-$pkgver.jar" \
    "$pkgdir/usr/share/java/$_pkgname-$pkgver.jar"
  install -Dm 644 "case-uco/java/dist/sleuthkit-caseuco-${pkgver}.jar" \
    "$pkgdir/usr/share/java"

  install -d "$pkgdir/usr/lib"
  install -Dm 644 "bindings/java/jni/.libs"/*.so.0.0.0 "$pkgdir/usr/lib"
  ln -s /usr/lib/libtsk_jni.so.0.0.0 "$pkgdir/usr/lib/libtsk_jni.so.0"
  ln -s /usr/lib/libtsk_jni.so.0.0.0 "$pkgdir/usr/lib/libtsk_jni.so"
}

